package cn.mccraft.uide.api.property.value;

import com.google.gson.JsonElement;
import com.google.gson.JsonPrimitive;

public class BooleanValue implements Value<Boolean> {

	private boolean value;
	
	public BooleanValue() {}

	public BooleanValue(boolean initialValue) {
		this.value = initialValue;
	}
	
	@Override
	public JsonElement serialize() {
		return new JsonPrimitive(getValue());
	}

	@Override
	public void deserialize(JsonElement jsonElement) {
		setValue(jsonElement.getAsBoolean());
	}
	
	public boolean get() {
		return value;
	}

	@Override
	public Boolean getValue() {
		return get();
	}
	
	public void set(boolean value) {
		this.value = value;
	}

	@Override
	public void setValue(Boolean value) {
		set(value);
	}
}
